/**
 * Copyright (c) 2023 OceanBase
 * OceanBase Migration Service LogProxy is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */

#pragma once

#include <utility>
#include <sys/prctl.h>
#include <sys/wait.h>
#include <mutex>
#include "thread.h"
#include "env.h"
#include "fs_util.h"
#include "convert_meta.h"
#include "config.h"
#include "oblog_config.h"

namespace oceanbase {
namespace logproxy {

class ForkBinlogThread {
public:
  static int invoke(const logproxy::ConvertMeta& meta, OblogConfig config);

private:
  static int serialize_configs(const ConvertMeta& client, const OblogConfig& config, const std::string& config_file);
};

int start_binlog_converter(std::string config);

int stop_binlog_converter(std::string status_config);

}  // namespace logproxy
}  // namespace oceanbase
